import mysql from 'mysql2/promise'

// 创建连接池，设置连接池的参数
const pool = mysql.createPool({
  host: 'localhost',
  user: 'root',
  password: '1993',
  database: 'jbook',
  waitForConnections: true,
  connectionLimit: 10,
  maxIdle: 10, // 最大空闲连接数，默认值和connectionLimit相同
  idleTimeout: 60000, // 空闲连接超时，单位为毫秒，默认值为60000
  queueLimit: 0, // 队列数
  enableKeepAlive: true, // 保持连接
  keepAliveInitialDelay: 0,
})

export default pool
